#{extends 'admintemplate.html' /}
#{set title:'Product' /}
#{set active:'active' /}

#{set main_title:'Quản Lý Sản Phẩm'/}
#{set sub_title:'Thêm/Xóa/Sửa Sản Phẩm'/}
#{set 'moreScripts'}
      <script src="@{'/public/admin/js/bootstrap-modal.js'}" type="text/javascript"></script>
#{/set}
<div class="span12" style="width: 960px!important;">
	#{if products.size() !=0 }
		<table id="product-table">
		<tr>
			<th class="table-header-repeat line-left minwidth-1"><a href="">Id</a>	</th>
			<th class="table-header-repeat line-left minwidth-1"><a href="">Name</a></th>
			<th class="table-header-repeat line-left"><a href="">Alias</a></th>
			<th class="table-header-repeat line-left"><a href="">Description Detail</a></th>
			<th class="table-header-repeat line-left"><a href="">Description Short</a></th>
			<th class="table-header-repeat line-left"><a href="">Image</a></th>
			<th class="table-header-repeat line-left"><a href="">Active</a></th>
			<th class="table-header-repeat line-left"><a href="">Category</a></th>
			<th class="table-header-repeat line-left"><a href="">Control</a></th>
		</tr>
		#{list items: products, as:'product'}
			<tr class="content_${content?.id}" id="col_${product_parity}">
				<td>${product?.id}</td>
				<td>${product?.name}</td>
				<td>${product?.alias}</td>
				<td>${product?.descDetail}</td>
				<td>${product?.descShort}</td>
				<td><a href="">${product?.image}</a></td>
				<td>${product?.active}</td>
				<td>${product?.category}</td>
				<td><a href="/admin/deleteProduct/${product?.id}"> Delete </a>
				<a href="/admin/viewEditProduct/${product?.id}"> Edit </a>
				#{if product?.active}
					<a href="/admin/hiddenItemProduct/${product?.id}"> Hidden </a>
				#{/if}
				#{else}
					<a href="/admin/activeItemProduct/${product?.id}"> Active </a>
				#{/else}
				
				</td>
			</tr>
		#{/list}
		#{pagination paginationInfo /}
		</table>
	#{/if}
	#{else}
		Không Có Sản Phẩm
	#{/else}
	<div style="padding: 16px 19px;" class="well">
		<form class="form" enctype="multipart/form-data" method="post" action="/admin/createProduct" id="addProductForm">
			<fieldset>
				<div class="clearfix">
					<div class="input">
						<h2 style="color: red;">Create Product</h2>
					</div>
				</div>
				<div class="clearfix">
					<label for="name">Name</label>
					<div class="input">
						<input type="text" name="name">
					</div>
				</div>
				<div class="clearfix">
					<label for="data">Image File</label>
					<div class="input">
						<input type="file" name="image">
					</div>
				</div>
				
				<div class="clearfix">
					<label for="description">Description Short</label>
					<div class="input">
						<textarea name="descShort" cols="200" rows="5"></textarea>
					</div>
				</div>
				
				<div class="clearfix">
					<label for="description">Description Detail</label>
					<div class="input">
						<textarea name="descDetail" cols="200" rows="5"></textarea>
					</div>
				</div>

				<div class="clearfix">
					<label for="selectbox">Category</label>
					<div class="input">
						<select name="category">
							#{list items: categories, as:'category'}
								<option value="${category?.alias}">${category?.name}</option>
							#{/list}
						</select>
					</div>
				</div>

				<input type="hidden" name="categoryId">
				<div class="actions">
					<input type="submit" value="Thêm" class="btn primary">
				</div>
			</fieldset>
		</form>
	</div>
</div>
